import { createApp } from 'vue'

import 'normalize.css'

import ElementPlus from 'element-plus'

import 'element-plus/dist/index.css'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import router from './router'

import store from './store/index'

import { ElMessage } from 'element-plus'

import App from './App.vue'

import './permission'
import ProTable from '@/components/table'

// 日程表

const app = createApp(App)

// 全局注册所有 element-plus 图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router)

app.use(store)

app.use(ElementPlus)

// 使用自定义表格插件
app.use(ProTable)

app.config.errorHandler = (err, instance, info) => {
  console.log('err:', err)
  console.log('instance:', instance)
  console.log('info:', info)
  // 显示全局错误提示
  ElMessage.error('出现异常.')
}

app.mount('#app')
